macos: handle NULL surface when creating GL context
authorChristian Hergert <chergert@redhat.com>
Wed, 29 Sep 2021 00:36:23 +0000 (17:36 -0700)
committerChristian Hergert <chergert@redhat.com>
Wed, 29 Sep 2021 00:36:23 +0000 (17:36 -0700)
Fixes #4279

gdk/macos/gdkmacosglcontext.c

index 09da35b69a617a48dc835b8899a914c11ea189bf..77391b9eaac7827d180e23137eeddcc32aabe0e9 100644 (file)
@@ -226,8 +226,8 @@ gdk_macos_gl_context_real_realize (GdkGLContext  *context,
 
   swapRect[0] = 0;
   swapRect[1] = 0;
-  swapRect[2] = surface->width;
-  swapRect[3] = surface->height;
+  swapRect[2] = surface ? surface->width : 0;
+  swapRect[3] = surface ? surface->height : 0;
 
   CGLSetParameter (cgl_context, kCGLCPSwapRectangle, swapRect);
   CGLSetParameter (cgl_context, kCGLCPSwapInterval, &sync_to_framerate);